package com.ruoyi.web.controller.borehole;

import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.validate.QueryGroup;
import com.ruoyi.web.domain.BhPlansCheck;
import com.ruoyi.web.domain.query.CheckDangerQuery;
import com.ruoyi.web.domain.query.DangerPageQuery;
import com.ruoyi.web.domain.query.ReformDangerQuery;
import com.ruoyi.web.domain.query.ShowDangerQuery;
import com.ruoyi.web.domain.vo.DangerBulletinVO;
import com.ruoyi.web.domain.vo.DangerDetailVO;
import com.ruoyi.web.domain.vo.DangerPageVO;
import com.ruoyi.web.domain.vo.DangerStatisticsVO;
import com.ruoyi.web.service.HiddenDangerService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@Tag(name = "隐患管理")
@RestController
@RequestMapping("/hiddenDanger")
public class HiddenDangerController {
    @Autowired
    private HiddenDangerService hiddenDangerService;

    @Operation(summary = "隐患整改列表页 - 分页查询")
    @GetMapping("/getDangerPage")
    public TableDataInfo<DangerPageVO> getDangerPage(@Validated(QueryGroup.class) DangerPageQuery dangerPageQuery, PageQuery pageQuery) {
        return hiddenDangerService.getDangerPage(dangerPageQuery, pageQuery);
    }

    @Operation(summary = "隐患整改-详情")
    @GetMapping("/getDangerDetail")
    public R<DangerDetailVO> getDangerDetail(@RequestParam("id") Integer id) {
        return hiddenDangerService.getDangerDetail(id);
    }

    @Operation(summary = "隐患整改-申请验收")
    @PostMapping("/reformDanger")
    public R<Void> reformDanger(@RequestBody ReformDangerQuery reformDangerQuery) {
        return hiddenDangerService.reformDanger(reformDangerQuery);
    }

    @Operation(summary = "隐患验收列表页 - 分页查询")
    @GetMapping("/getCheckPage")
    public TableDataInfo<DangerPageVO> getCheckPage(@Validated(QueryGroup.class) DangerPageQuery dangerPageQuery, PageQuery pageQuery) {
        return hiddenDangerService.getCheckPage(dangerPageQuery, pageQuery);
    }

    @Operation(summary = "隐患验收")
    @PostMapping("/checkDanger")
    public R<Void> checkDanger(@RequestBody CheckDangerQuery checkDangerQuery) {
        return hiddenDangerService.checkDanger(checkDangerQuery);
    }

    @Operation(summary = "典型隐患公示")
    @PostMapping("/showDanger")
    public R<Void> showDanger(@RequestBody ShowDangerQuery showDangerQuery) {
        return hiddenDangerService.showDanger(showDangerQuery);
    }

    @Operation(summary = "隐患整改-验收操作记录")
    @GetMapping("/getCheckRecord")
    public R<List<BhPlansCheck>> getCheckRecord(@RequestParam("id") Integer id) {
        return hiddenDangerService.getCheckRecord(id);
    }

    @Operation(summary = "隐患整改-首页公示")
    @GetMapping("/getShowList")
    public R<List<DangerDetailVO>> getShowList() {
        return hiddenDangerService.getShowList();
    }

    @Operation(summary = "首页 - 隐患简报")
    @GetMapping("/getDangerBulletin")
    public R<DangerBulletinVO> getDangerBulletin() {
        return hiddenDangerService.getDangerBulletin();
    }

    @Operation(summary = "首页 - 隐患统计")
    @GetMapping("/getDangerStatistics")
    public R<List<DangerStatisticsVO>> getDangerStatistics() {
        return hiddenDangerService.getDangerStatistics();
    }
}
